/* The file is saved in UTF-8 codepage.
 * Check: «Stereotype», Section mark-§, Copyright-©, Alpha-α, Beta-β, Smile-☺
 */
package cz.pecinovsky.english.lootp._125_;


import cz.pecinovsky.english.lootp._000_.Run;

import cz.pecinovsky.english.lootp.manager.Ellipse;
import cz.pecinovsky.english.lootp.manager.Rectangle;
import cz.pecinovsky.english.lootp.manager.Mover;
import cz.pecinovsky.english.lootp.manager.Triangle;


import cz.pecinovsky.english.lootp.manager.CanvasManager_Envelope.               CanvasManager;



////////////////////////////////////////////////////////////////////////////////
//%%+  +++++ End of ignored starting test - place for imports +++++
//%I+ <0 //=133b //Test zůstává ve 133b spolu s testovanými třídami
//
//import správce.*;
//%I-
//%I+ >=133x
//
//import cz.pecinovsky.english.lootp.canvasmanager.Ellipse;
//import cz.pecinovsky.english.lootp.canvasmanager.Rectangle;
//import cz.pecinovsky.english.lootp.canvasmanager.Mover;
//import cz.pecinovsky.english.lootp.canvasmanager.CanvasManager;
//import cz.pecinovsky.english.lootp.canvasmanager.Triangle;
//%I-
//%A+ >=133x

import cz.pecinovsky.english.lootp.utility.IO;
//%A-
//%X+ xxxxx Start of the ovejumped text with declaration of the envelope xxxxx
/*******************************************************************************
 *<pre>
 * Předchozí: _109_Test v projektu 009z_01_Tvary
 *
 * Přidáno:
 *    - testSmoothMovement
 *
 * Upraveno:
 *      *
 *</pre>
 */
public class Test_126_
{      private Test_126_() {}       static
////////////////////////////////////////////////////////////////////////////////
//%X- ----- End of the ovejumped text with declaration of the envelope -----


/*******************************************************************************
 * The class {@code Test} defines a set of unit tests
 * created in the interractive mode.
 *
 * Oproti minulé verzi v projektu 009z_01_Tvary:
 *    - Přibyl testSmoothMovement
 *
 * @author Rudolf PECINOVSKÝ
 * @version 6.03.2017 — 2010-11-08
 */
public class Test extends junit.framework.TestCase
{
    private Rectangle rectangl0;
    private Ellipse   ellipse0;
    private Triangle  triangle0;
    private Rectangle rectangl1;
    private Ellipse   ellipse1;
    private Triangle  triangle1;
    private CanvasManager CM;



//== CONSTANT CLASS ATTRIBUTES =================================================
//== VARIABLE CLASS ATTRIBUTES =================================================
//== STATIC CONSTRUCTOR (CLASS INITIALIZER, STATIC INICITALIZING BLOCK) ========
//== CONSTANT INSTANCE ATTRIBUTES ==============================================
//== VARIABLE INSTANCE ATTRIBUTES ==============================================
//== CLASS GETTERS AND SETTERS =================================================
//== OTHER NON-PRIVATE CLASS METHODS ===========================================

//##############################################################################
//== CONSTUCTORS AND FACTORY METHODS ===========================================

    /***************************************************************************
     * Creates a test with a given name.
     *
     * @param testName  The name of the created test
     */
    public Test(String testName)
    {
        super(testName);
    }



//== PREPARATION AND CLEANING THE FIXTURE ======================================

    /***************************************************************************
     * Creates a test fixture, i.e. a set of objects that will be prepared
     * before each run test.
      */
    @Override
    protected void setUp()
    {
        rectangl0 = new Rectangle();
        ellipse0  = new Ellipse();
        triangle0 = new Triangle();
        rectangl1 = new Rectangle   (50, 50, 200, 100);
        ellipse1  = new Ellipse     (50, 50, 200, 100);
        triangle1 = new Triangle(50, 50, 200, 100);
        rectangl0.paint();
        ellipse0 .paint();
        triangle0.paint();
        rectangl1.paint();
        ellipse1 .paint();
        triangle1.paint();
        IO.inform("Fixture prepared");
    }


    /***************************************************************************
     * Clean up after each test.
     */
    @Override
    protected void tearDown()
    {
    }



//== PRIVATE AND AUXILIARY CLASS METHODS =======================================
//== PRIVATE AND AUXILIARY INSTANCE METHODS ====================================
//== EMBEDDED TYPES AND INNER CLASSES ==========================================
//== THE TESTS =================================================================
//
//     /***************************************************************************
//      *
//      */
//     public void testXXX()
//     {
//     }
    public void testNewLine()
    {
        System.out.print("Před odřádkováním");
        System.err.print("Před odřádkováním");
        IO.inform("Před odřádkováním");

        System.out.println(" - druhá polovina");
        System.err.println(" - druhá polovina");
        IO.inform("Po odřádkování");
    }

    public void testMovements()
    {
        triangle1.moveDown();
        ellipse1 .moveRight();
        rectangl1.paint();
    }

    public void testMovements2()
    {
        ellipse1 .moveDown();
        triangle1.moveRight();
        rectangl1.paint();
    }


    public void testSmoothMovements()
    {
        Mover mover = new Mover(3);
        mover.moveBy( 0, 50, triangle1);
        mover.moveTo(50,  0, ellipse1);
        rectangl0.paint();
    }


    public void testStandardOutput()
    {
        System.out.print  ("Bez odřádkování - ");
        System.out.println("s odřádkováním");

        System.out.print  ("Obdélník0: ");
        System.out.println(rectangl0);

        System.out.print  ("Elipsa0:   " + ellipse0);
        System.out.println();
        System.out.println("Trojúhel0: " + triangle0);

        System.out.println("\nObdélník1: " + rectangl1 +
                           "\nElipsa1:   " + ellipse1 +
                           "\nTrojúhel1: " + triangle1);

        System.err.println("Tohle píšu do chybového výstupu");
        System.out.println("\nA tohle už ne");
    }
}

//%%- ---- Start of the ovejumped text with closing of the envelope ----
//== TESTING CLASSES AND METHODS ===============================================

    /***************************************************************************
     * Instances of the class {@code TearDown}
     * take care about cleaning up between particular tests
     * They executes the code, which is impossible to incorporate
     * into the method {@link #tearDown()},
     * until the students will not be able to program.
     */
    private static class TearDown implements Run.ITD
    {
        /** {@inheritDoc} */
        @Override
        public void cleanUp()
        {
            CanvasManager.getInstance().removeAll();
        }
    }


    /***************************************************************************
     * Test method.
     */
    public static void test()
    {
        Run.tests(Test.class,
                new TearDown(),
//                "testPosuny",
//                "testSmoothMovement",
                "testStandardOutput",
                "testNewLine",
                "");
        System.exit(0);
    }
    /** @param args Parametry příkazového řádku - nepoužívané. */
    public static void main(String[] args)  {  test();  }
}
